<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>

<script>
  let arr =[11,3,60,6,8,22];

  // arr.sort(); // 默认是字母顺序排序
  // console.log(arr) // 11 22 3 6 60 8

  // arr.sort(function (a,b) {
  //   return a-b;
  // });

  // 使用箭头函数来简写
  arr.sort( (a,b)=>a-b );
  console.log(arr.toString()) // 3,6,8,11,22,60
</script>

</body>
</html>
